<template>
  <el-card class="box-card" shadow="never">

    <div slot="header" class="header-card">
      <span class="header-card-title">主订单</span>
    </div>

    <el-row :gutter="24">
      <el-col>
        <el-table :data="tableData" border>

          <el-table-column label="订单编号" prop="orderNo" show-overflow-tooltip align="center">
            <template #default="{row}">
              <el-button class="enable-text-select" type="text" @click="handleTo(row)">{{ row.orderNo }}</el-button>
            </template>
          </el-table-column>

          <el-table-column label="订单状态" prop="orderStatus" show-overflow-tooltip align="center">
            <template #default="{row}">
              {{ selectDictLabel(dict.type.order_status, row.orderStatus) || '-' }}
            </template>
          </el-table-column>

          <el-table-column label="出租方" prop="lessorName" show-overflow-tooltip align="center"/>

          <el-table-column label="承租方" prop="leaseeName" show-overflow-tooltip align="center"/>

          <el-table-column label="交车总数量" prop="quantityDelivery" show-overflow-tooltip align="center"/>

          <el-table-column label="已交车数量" prop="quantityDelivered" show-overflow-tooltip align="center"/>

          <el-table-column label="未交车数量" prop="quantityUndelivered" show-overflow-tooltip align="center"/>

        </el-table>
      </el-col>
    </el-row>
  </el-card>
</template>

<script>
export default {
  name: 'mainOrder',//主订单
  dicts: ['order_status'],

  props: {
    value: {
      type: Object,
      default: () => {
        return {};
      },
    },
    state: {
      type: String,
      default: "",
    },
  },

  computed: {
    ruleForm: {
      get() {
        let that = this
        const proxy = new Proxy(that.value, {
          get(target, key, value) {
            return Reflect.get(target, key)
          }
        })
        return proxy
      }
    },
    tableData() {
      let arr = []
      let obj = this._.cloneDeep(this.ruleForm)
      for (let key in obj) {
        if (typeof obj[key] === 'object') {
          delete obj[key]
        }
      }
      arr.push(obj)
      return arr
    }
  },
  data() {
    return {};
  },
  created() {
  },
  mounted() {
  },
  methods: {
    handleTo(row) {
      this._toPage({
        name: 'OrderDetails',
        query: {
          type: row.carType,
          orderId: row.orderId,
          calcSchemeId: row.calcSchemeId,
        },
      });
    }
  },
};
</script>

<style lang="scss" scoped>
@import "@/styles/cwgd/formScss.scss";
</style>



